#!/bin/bash
source /etc/profile
. $BEETLE_SHELL_PATH/error.sh

#版本号
version=$1

# 分支名
branch=$2

codePath=/usr/local/beetle/code/matrix-ui-vue
workPath=/usr/local/nginx
configPath=/usr/local/beetle/config/matrix-ui-vue
bakPath=/usr/beetle/appbak/matrix-ui-vue
bakName=matrix-ui-vue
projectName=matrix-ui-vue

bash $BEETLE_SHELL_PATH/git_checkout.sh ${codePath} ${branch} || error_exit

bash $BEETLE_SHELL_PATH/bak.sh ${workPath} ${projectName} ${bakPath} ${bakName} || error_exit

cd ${codePath} || error_exit

cp -R ${configPath}/* . || error_exit

npm run build || error_exit

cp -R ${codePath}/dist/* ${workPath}/${projectName}/ || error_exit

